package top.cluski.feieprint.api.teable.entity;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Set;

import static top.cluski.feieprint.api.teable.entity.Filter.Conjunction.and;

@Data
@Accessors(chain = true)
public class Filter {
    Conjunction conjunction;
    Set<FilterItem<?>> filterSet;

    public static Filter create() {
        return new Filter();
    }

    public enum Operator {
        is,
        isNot,
        isGreater,
        isGreaterEqual,
        isLess,
        isLessEqual,
        isEmpty,
        isNotEmpty,
        contains,
    }

    public enum Conjunction {
        and,
        or
    }

    public static Filter emptyFilter() {
        return Filter.create()
                .setConjunction(and)
                .setFilterSet(Set.of());
    }

//    public static void main(String[] args) {
//        FilterItem<TimeFilterValue> a = FilterItem.<TimeFilterValue>create()
//                .setField("日期")
//                .setOperator(Operator.is)
//                .setValue(TimeFilterValue.create()
//                        .setMode(FilterItem.TimeFilterMode.extraDate)
//                        .setExactDate(ZonedDateTime.now(ZoneId.of("GMT+0"))));
//        System.out.println(JSONObject.toJSONString(a));
//    }
}
